package generics;

public class Pair<T> {
	public Pair() {
		first = null;
		second = null;
	}

	public Pair(T first, T second) {
		this.first = first;
		this.second = second;
	}

	public T getFirst() {
		return first;
	}

	public T getSecond() {
		return second;
	}

	public void setFirst(T newValue) {
		first = newValue;
	}

	public void setSecond(T newValue) {
		System.out.println("set second in Pair");
		second = newValue;
	}
	
	public static <T extends Comparable<T>> T min(T[] a) {// almost correct
		if (a == null || a.length == 0)
			return null;
		T smallest = a[0];
		for (int i = 1; i < a.length; i++)
			if (smallest.compareTo(a[i]) > 0)
				smallest = a[i];
		return smallest;
	}

	private T first;
	private T second;
	
	
}